package biz.ezcom.design.pattern.singleton.lazy;

/**
 * 懒汉式
 */
public class Singleton {
	private static Singleton instance;
	
	private Singleton(){}
	
	public static Singleton getInstance(){
		if(instance == null){
			//双重加锁
			synchronized (Singleton.class) {
				if(instance == null){
					instance = new Singleton();
				}
			}
		}
		return instance;
	}
}
